/*
 * BinaryDivOperatorAst.cpp
 *
 *  Created on: 30 Oct 2010
 *      Author: kn308
 */

#include "BinaryDivOperatorAst.h"

namespace MAlice
{

BinaryDivOperatorAst::BinaryDivOperatorAst(ExpressionAst* lhs,
		ExpressionAst* rhs) :
	BinaryOperatorAst("/", lhs, rhs)
{
}

BinaryDivOperatorAst::~BinaryDivOperatorAst()
{
}

llvm::Value* BinaryDivOperatorAst::generate()
{
	llvm::Value* LHS = getLHS()->generate();
	llvm::Value* RHS = getRHS()->generate();
	llvm::IRBuilder<>* builder = MAlice::Codegen::get()->getBuilder();

	return builder->CreateSDiv(LHS, RHS, getName(LHS, RHS));
}
}
